<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    "use strict"
    // 1.不会意外的创建全局变量
    function foo() {
      message = "Hello World"
    }
    foo()
    console.log(message) 
  </script>

  <script>
    "use strict"
    // 2.发现静默错误
    var obj = { name: "why" }
    Object.defineProperty(obj, "name", { writable: false })
    obj.name = 'kobe'
    console.log(obj.name)

  </script>

  <script>
    "use strict"
    // 3.参数名称不能相同
    function foo(num, num) {
    }
  </script>


  <script>
    "use strict"
    // 不能以0开头
    console.log(0o123)
    console.log(0123)
  </script>

  <script>
    "use strict"
    // 5.eval函数不能为上层创建变量
    eval(`var message = "Hello World"`)
    console.log(message)
  </script>

  <script>
    "use strict"
    // 6.严格模式下, this是不会转成对象类型的
    function foo() {
      console.log(this)
    }
    foo.apply("abc")
    foo.apply(123)
    foo.apply(undefined)
    foo.apply(null)
  </script>
  <script>
    "use strict"
    // 独立函数执行默认模式下, 绑定window对象
    // 在严格模式下, 不绑定全局对象而是undefined
    foo()
  </script>
</body>

</html>